﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IrisGenerator.Common.DatabaseModel;

namespace IrisGenerator.Modules.SqlServer2005.Formater
{
    internal class SqlServerFormatter
    {
        public string FormatRequestName(Request request)
        {
            if (request == null)
                return string.Empty;
            return "[" + request.ReqName + "]";
        }

        internal string FormatColumnName(Column column)
        {
            if (column == null)
                return string.Empty;
            
            return "[" + column.ColName + "]";
        }

        internal string FormatParameterName(RequestParameter param)
        {
            if (param == null)
                return string.Empty;

            return "@" + param.ReqParName;
        }

        internal string FormatTableName(Table table)
        {
            if (table == null) 
                return string.Empty;

            string name=string.Empty;
            if (!string.IsNullOrEmpty(table.TabOwner))
                name += "[" + table.TabOwner + "].";
            name += "[" + table.TabName + "]";

            return name;
        }
    }
}
